package com.zhou.org.mapper;

import com.zhou.org.dao.Org;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhou.org.dto.OrgQueryDto;
import com.zhou.org.model.OrgTree;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lang.zhou
 * @since 2022-08-23
 */
@Repository
public interface OrgMapper extends BaseMapper<Org> {
    List<OrgTree> getPageList(@Param("dto") OrgQueryDto dto);
    List<OrgTree> getOrgList(@Param("dto") OrgQueryDto dto);
    List<Map<String,Object>> getDepartmentTree(Map<String,Object> map);
    List<Map<String,Object>> getOrgTreeByType(Map<String,Object> map);

    void deleteOrgByUserId(@Param("userId")int userId);

    /**
     * 递归查询orgid下面的所有子节点
     */
    List<OrgTree> getChildOrgObject(@Param("orgId")int orgId);
    List<OrgTree> getOrgTree(@Param("orgType")int orgType,@Param("pid")int pid);
    /**
     * 查询orgid所有父节点
     */
    List<OrgTree> getParentOrgObject(@Param("orgId")int orgId);
    List<OrgTree> getOrgObject(@Param("orgId")int orgId);
}
